<?php
class GeneralUtils {

	public function LasTimeHere($time) {

		if(time() < $time)	return "invalid time";
		$seconds = time()-$time;
		if($seconds < 60)	return "$seconds secs back";
		$minutes = floor( $seconds / ( int )60 );
		if($minutes < 60)	return "$minutes min back";
		$hours = floor( $minutes / ( int )60 );
		if($hours < 24)	return "$hours hrs back";
		$days = floor( $hours / ( int )24 );
		if($days < 7)	return "$days days ago";
		$weeks = floor( $days / ( int )7 );
		if($weeks < 5)	return "$weeks weeks ago";
		$months = floor( $days / ( int )30 );
		if($months < 12)	return "$months months ago";
		$years = floor( $days / ( int )365 );
		return "$years years ago";
	}


//	Check string in associative array

	public static function Search_in_Array($Array, $key, $Str){
	
		foreach($Array as $value){
			if($value[$key]== $Str){
				return true;
			}
		}
		return false;
	}
	
	
	
  
}
?>